import {
  axios
} from '@/utils/request'
/**
 * 角色模块api
*/

// 获取角色列表
function getRoleAllData (query) {
  return axios({
    url: '/user-service/role/list',
    method: 'get',
    query
  })
}
// 新增
function addRole (data) {
  console.log(data, 'data')
  return axios({
    url: '/user-service/role',
    method: 'post',
    data
  })
}

// 编辑
function editRole (data) {
  return axios({
    url: '/user-service/role',
    method: 'put',
    data
  })
}

// 通过角色id查询相应的菜单
function getRoleMenuById (params) {
  return axios({
    url: '/user-service/role/menus',
    method: 'get',
    params
  })
}

// 删除用户
function deleteRoles (data) {
  return axios({
    url: '/user-service/role',
    method: 'delete',
    data
  })
}

export default {
  getRoleAllData,
  addRole,
  editRole,
  getRoleMenuById,
  deleteRoles
}
